package function

import (
	"context"
	"flow-calc/core"
	"flow-calc/core/log"
)

/**
 *    Description: 校验特性的函数Function
 *    Date: 2024/3/18
 */

type VFunction struct {
	BaseFunction
}

func NewVFunction() core.Function {
	f := new(VFunction)
	f.metaData = make(map[string]interface{})
	return f
}

func (f *VFunction) Call(ctx context.Context, flow core.Flow) error {
	log.Logger().InfoCtx(ctx, "VFunction = %v", flow)
	if err := core.Pool().CallFunction(ctx, f.Config.FName, flow); err != nil {
		log.Logger().ErrorCtx(ctx, "VFunction Name: %s Called Error err = %s\n", f.Config.FName, err)
		return err
	}
	return nil
}
